package com.example.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.reflect.IGenericTypeResolver;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.GoodsOrders;
import com.example.mapper.GoodsOrdersMapper;

import com.example.service.IGoodsOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单Service业务层处理
 *
 * @author kzc
 * @date 2023-04-22
 */
@Service
public class GoodsOrdersServiceImpl extends ServiceImpl<GoodsOrdersMapper,GoodsOrders>  implements IGoodsOrdersService
{
    @Autowired
    private GoodsOrdersMapper goodsOrdersMapper;

    /**
     * 查询订单
     *
     * @param sgoId 订单主键
     * @return 订单
     */
    @Override
    public GoodsOrders selectGoodsOrdersBySgoId(Integer sgoId)
    {
        return goodsOrdersMapper.selectGoodsOrdersBySgoId(sgoId);
    }

    /**
     * 查询订单列表
     *
     * @param goodsOrders 订单
     * @return 订单
     */
    @Override
    public List<GoodsOrders> selectGoodsOrdersList(GoodsOrders goodsOrders)
    {
        return goodsOrdersMapper.selectGoodsOrdersList(goodsOrders);
    }

    /**
     * 新增订单
     *
     * @param goodsOrders 订单
     * @return 结果
     */
    @Override
    public int insertGoodsOrders(GoodsOrders goodsOrders)
    {

        return baseMapper.insert(goodsOrders);
    }

    /**
     * 修改订单
     *
     * @param goodsOrders 订单
     * @return 结果
     */
    @Override
    public int updateGoodsOrders(GoodsOrders goodsOrders)
    {

        return goodsOrdersMapper.updateGoodsOrders(goodsOrders);
    }

    /**
     * 批量删除订单
     *
     * @param sgoIds 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteGoodsOrdersBySgoIds(Integer[] sgoIds)
    {
        return goodsOrdersMapper.deleteGoodsOrdersBySgoIds(sgoIds);
    }

    /**
     * 删除订单信息
     *
     * @param sgoId 订单主键
     * @return 结果
     */
    @Override
    public int deleteGoodsOrdersBySgoId(Integer sgoId)
    {
        return goodsOrdersMapper.deleteGoodsOrdersBySgoId(sgoId);
    }

    @Override
    public List<GoodsOrders> getid(Integer id) {
        QueryWrapper<GoodsOrders> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("users_id",id);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<GoodsOrders> selectphone(String phone) {
        QueryWrapper queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("user_phone",phone);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<GoodsOrders> selectuserid(String userid) {
        QueryWrapper queryWrapper=new QueryWrapper<>();
         queryWrapper.eq("users_id", userid);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public int upsta(Integer sgoId) {
        return baseMapper.upsta(sgoId);
    }




}
